package com.mgq.hutool;

import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * <b>功能：</b><br>
 * <b>Copyright TCSL</b>
 * <li>版本&nbsp;&nbsp;&nbsp;&nbsp;修改日期&nbsp;&nbsp;&nbsp;&nbsp;部　　门&nbsp;&nbsp;&nbsp;&nbsp;作　者&nbsp;&nbsp;&nbsp;&nbsp;变更内容</li><hr>
 * <li>v1.0&nbsp;&nbsp;&nbsp;&nbsp;20220419&nbsp;&nbsp;营业后台&nbsp;&nbsp;&nbsp;&nbsp;马广奇&nbsp;&nbsp;&nbsp;&nbsp;创建类</li>
 * <br><br>
 *
 * @author 马广奇
 * @version 2022-04-19 19:15
 */
public class Test {
    public static void main(String[] args) {
        dateTimeTest();
    }
private static void dateTimeTest() {
    DateTime dateTime = DateUtil.offsetDay(new Date(), 300);
    long l = DateUtil.betweenDay(new Date(), new Date(), true);
    System.out.println(l);
   // DateUtil.rangeToList(new Date(), dateTime, DateField.DAY_OF_YEAR).forEach(i-> System.out.println(i));
}
    private static void http() {
        String body = HttpRequest.post("http://192.168.9.217:8080/rest/api/2/search")
                .header("User-Agent", "PostmanRuntime/7.29.0")
                .header("Authorization", "Basic emVuZ2ZhbnBpbmc6dGNzbEN5NyE=")
                .header("Content-Type", "application/json")
                .body("{\"jql\":\"project=TCSL-CY7 and Sprint=182 and type in (开发子任务,测试子任务)\",\"maxResults\":1,\"startAt\":0,\"validateQuery\":true}")
                .execute()
                .body();
        System.out.println(body);


        Map<String, Object> queryParams = new HashMap<>();
        queryParams.put("username", "马广奇");
        queryParams.put("startAt", String.valueOf(0));
        queryParams.put("maxResults", String.valueOf(1000));
        queryParams.put("includeActive", String.valueOf(true));
        queryParams.put("includeInactive", String.valueOf(false));
        String params = HttpUtil.toParams(queryParams);
        System.out.println(HttpRequest.get("http://192.168.9.217:8080/rest/api/2/user/search?"+params)
                .header("Authorization", "Basic emVuZ2ZhbnBpbmc6dGNzbEN5NyE=")
                .header("Content-Type", "application/json")

                .execute()
                .body());
    }
}
